<!DOCTYPE html>
<html>
<head>
    <title>Window Size Example</title>
</head>
<body>
    <p>Hello world!</p>
    <script type="text/javascript">

        var pageWidth = window.innerWidth,
            pageHeight = window.innerHeight;
            
        if (typeof pageWidth != "number"){
            if (document.compatMode == "CSS1Compat"){
                pageWidth = document.documentElement.clientWidth;
                pageHeight = document.documentElement.clientHeight;
            } else {
                pageWidth = document.body.clientWidth;
                pageHeight = document.body.clientHeight;
            }
        }

        alert("Width: " + pageWidth);
        alert("Height: " + pageHeight);
    </script>
</body>
</html>
